" -----------------------------------------------------------------------------
"  General Settings
" -----------------------------------------------------------------------------

colorscheme torte

" Show line numbers
set number

" Add common search paths
set path+=/usr/local/include,/opt/local/include

" Enable most intuitive backspace behavior
set bs=2

" Expand tabs to spaces
set expandtab

" Don't replace tabs with spaces in makefiles
autocmd FileType make set noexpandtab
autocmd FileType * :set paste

" Set scroll to 2 lines (default is 32)
" Use with CTRL+D and CTRL+U
set scroll=2

" Set tabs to 4 spaces
set softtabstop=4 
set tabstop=4 
set shiftwidth=4

" Colorize search results
set hlsearch 

" Show search results while typing
set incsearch

" Set auto-indent rules
set autoindent

" Set filetype dependent indention rules
filetype plugin indent on

" Disable annoying backup/swap files
set nobackup
set noswapfile
set nowritebackup 

" Turn off vi compatibility
set nocompatible

" Show the ruler at the bottom
set ruler

" Show nice title in xterm
set title

" Set ignore case when searching using only lower case characters
set ignorecase
"set smartcase

" Enable syntax coloring
syntax enable
syntax on

" Disable Ex mode (bastard!)
:map Q <Nop>

" Yank until end of line
map Y y$

" Easy panel switching
" - ctrl-j jumps to left
" - ctrl-l jumps to right
" - ctrl-k jumpt to top
" - ctrl-j jumps to bottom
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>


" Easy buffer switching
" Shift-K jumps to previous buffer
" Shift-J jumps to next buffer
nnoremap <S-K> :bp<CR>
nnoremap <S-J> :bn<CR>

" Split behavior.
set splitbelow
set splitright


" I don't know what this is.
fun! OpenFileBrowser()
    let file = expand("%:t")
    :Ve
    exec ":normal 1G/^" . file . "\n"
endf


:map <F2> :tab split<CR>
:map <F3> :vsplit<CR>



"
" OpenFile function.
" Modelled after the Firefox "Open Link in New Tab"-command.
"
fun! OpenFile()
  let tab_id = expand("%")
  tab split
  tabmove
  normal gf
  while tab_id != expand("%")
    tabprev
  endw
  normal j
endf


" Map CTRL-G to the OpenFile function
:map <C-G> :call OpenFile()<CR>



"
" Vundle
"
set nocompatible               " be iMproved
filetype off                   " required!

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" let Vundle manage Vundle
" required! 
Bundle 'gmarik/vundle'

" My Bundles here:
"
" original repos on github
Bundle 'scrooloose/nerdtree'

" vim-scripts repos
Bundle 'Align'

" non github repos
Bundle 'git://git.wincent.com/command-t.git'

filetype plugin indent on     " required!
"
" Brief help
" :BundleList          - list configured bundles
" :BundleInstall(!)    - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed..

let NERDTreeIgnore = ['\.o$']

